/*
 * @Description: 支付btn
 * @Author: buwei.huang
 * @Date: 2019-08-14 17:12:46
 * @Last Modified by: buwei.huang
 * @Last Modified time: 2019-09-09 17:07:34
 */
<script>
import baseBtn from './baseBtn'
import { getPaymentNo } from '../../api/api.js'
export default {
  extends: baseBtn,
  data() {
    return {
      isClick: true,
      btnText: '立即支付',
      btnClassName: 're_btn_pay'
    }
  },
  methods: {
    btnEvent() {
      console.log('paybtn---isClick:' + this.isClick)
      if (this.isClick) {
        this.isClick = false
        getPaymentNo().then(res => {
          // alert('payMentStr' + res.payMentStr + '----' + res.payMent)
          try {
            window.doPaymentByType(res.payMent, res.payMentStr, () => {
              this.$AppRouterUtils.open('paymentResult.html?_bbv=false&orderNO=' + res.orderNo + '&paymentStatu=' + 1)
            }, () => {
              this.$AppRouterUtils.open('paymentResult.html?_bbv=false&orderNO=' + res.orderNo + '&paymentStatu=' + 0)
            })
          } catch (err) {
            console.dir(err)
            this.isClick = true
          }
        }).catch(err => {
          console.dir(err)
          this.isClick = true
        })
      }
    }
  }
}
</script>
<style>
.re_btn_pay {
  width: 240px;
  height: 64px;
  color: #fff;
}
</style>
